'''
AIOHTTP的基本用法
'''
import aiohttp
import requests
import asyncio

async def fetch(session,url):
    async with session.get(url) as response:
        return await response.text()

async def main():
    async with aiohttp.ClientSession() as session:
        text = await fetch(session,"http://www.baidu.com")
        print("text ",text)
        
#loop = asyncio.get_event_loop()
#loop.run_until_complete(main())

# 也可以直接用run代替
asyncio.run(main())
        